package com.rybbaby.tss.platform.sysDept.entity;

import com.rybbaby.tss.platform.sysOrganization.entity.SysOrganization;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @description 部门
 * 
 * @author 雷春琼
 * 
 * @createDate 2017-08-09 上午11:42:02
 */
@Entity
@Table(name = "sys_dept")
@DynamicUpdate(true)
@DynamicInsert(true)
public class SysDept implements Serializable {
	
	private static final long serialVersionUID = 9465129746426L;
	
	/** 部门Id **/
	private Integer id;
	/** 部门名称 **/
	private String deptName;
	/** 上级部门 **/
	private Integer parentId;
	/** 创建时间 **/
	private java.sql.Timestamp createTime;
	/** 成员数 **/
	private Integer memberCount;
	/** 权重 **/
	private Integer weight;
	/** 状态 **/
	private Integer status;
	/**  **/
	private String deptHead;
	/** 下级部门数 **/
	private Integer childrenDeptCount;
	/** 版本 **/
	private Integer version;
	/** 组织id **/
	private String orgId;
	/** 组织 **/
	private SysOrganization sysOrganization;

	/**
	 * 方法: 取得部门Id
	 *
	 * @return java.lang.Integer 部门Id
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", nullable= false, length = 11)
	public Integer getId() {
		return this.id;
	}
	
	/**
	 * 方法: 设置部门Id
	 *
	 * @param id 部门Id
	 */
	public void setId(Integer id) {
		this.id = id;
	}
	
	/**
	 * 方法: 取得部门名称
	 *
	 * @return java.lang.String 部门名称
	 */
	@Column(name = "deptName", nullable= true, length = 50)
	public String getDeptName() {
		return this.deptName;
	}
	
	/**
	 * 方法: 设置部门名称
	 *
	 * @param deptName 部门名称
	 */
	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}
	
	/**
	 * 方法: 取得上级部门
	 *
	 * @return java.lang.Integer 上级部门
	 */
	@Column(name = "parentId", nullable= true, length = 11)
	public Integer getParentId() {
		return this.parentId;
	}
	
	/**
	 * 方法: 设置上级部门
	 *
	 * @param parentId 上级部门
	 */
	public void setParentId(Integer parentId) {
		this.parentId = parentId;
	}
	
	/**
	 * 方法: 取得创建时间
	 *
	 * @return java.sql.Timestamp 创建时间
	 */
	@Column(name = "createTime", nullable= true, length = 19)
	public java.sql.Timestamp getCreateTime() {
		return this.createTime;
	}
	
	/**
	 * 方法: 设置创建时间
	 *
	 * @param createTime 创建时间
	 */
	public void setCreateTime(java.sql.Timestamp createTime) {
		this.createTime = createTime;
	}
	
	/**
	 * 方法: 取得成员数
	 *
	 * @return java.lang.Integer 成员数
	 */
	@Column(name = "memberCount", nullable= true, length = 11)
	public Integer getMemberCount() {
		return this.memberCount;
	}
	
	/**
	 * 方法: 设置成员数
	 *
	 * @param memberCount 成员数
	 */
	public void setMemberCount(Integer memberCount) {
		this.memberCount = memberCount;
	}
	
	/**
	 * 方法: 取得权重
	 *
	 * @return java.lang.Integer 权重
	 */
	@Column(name = "weight", nullable= true, length = 11)
	public Integer getWeight() {
		return this.weight;
	}
	
	/**
	 * 方法: 设置权重
	 *
	 * @param weight 权重
	 */
	public void setWeight(Integer weight) {
		this.weight = weight;
	}

	
	/**
	 * 方法: 取得
	 *
	 * @return java.lang.Integer 
	 */
	@Column(name = "status", nullable= true, length = 11)
	public Integer getStatus() {
		return this.status;
	}
	
	/**
	 * 方法: 设置
	 *
	 * @param status 
	 */
	public void setStatus(Integer status) {
		this.status = status;
	}
	
	/**
	 * 方法: 取得
	 *
	 * @return java.lang.String 
	 */
	@Column(name = "deptHead", nullable= true, length = 32)
	public String getDeptHead() {
		return this.deptHead;
	}
	
	/**
	 * 方法: 设置
	 *
	 * @param deptHead 
	 */
	public void setDeptHead(String deptHead) {
		this.deptHead = deptHead;
	}
	
	/**
	 * 方法: 取得下级部门数
	 *
	 * @return java.lang.Integer 下级部门数
	 */
	@Column(name = "childrenDeptCount", nullable= true, length = 11)
	public Integer getChildrenDeptCount() {
		return this.childrenDeptCount;
	}
	
	/**
	 * 方法: 设置下级部门数
	 *
	 * @param childrenDeptCount 下级部门数
	 */
	public void setChildrenDeptCount(Integer childrenDeptCount) {
		this.childrenDeptCount = childrenDeptCount;
	}
	
	/**
	 * 方法: 取得版本
	 *
	 * @return java.lang.Integer 版本
	 */
    @Version
	@Column(name = "version", nullable= true, length = 11)
	public Integer getVersion() {
		return this.version;
	}
	
	/**
	 * 方法: 设置版本
	 *
	 * @param version 版本
	 */
	public void setVersion(Integer version) {
		this.version = version;
	}

	/**
	 * 组织id
	 * @return
	 */
	@Column(name = "orgId", nullable= true, length = 32)
	public String getOrgId() {
		return orgId;
	}

	public void setOrgId(String orgId) {
		this.orgId = orgId;
	}

	@JoinColumn(name = "orgId" , insertable = false , updatable = false)
	@ManyToOne(fetch = FetchType.LAZY , targetEntity = SysOrganization.class)
	public SysOrganization getSysOrganization() {
		return sysOrganization;
	}

	public void setSysOrganization(SysOrganization sysOrganization) {
		this.sysOrganization = sysOrganization;
	}
}